﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

namespace WebApplication2
{
    public partial class Calendars : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        private void proveriDatume()
        {
            if (MyCalendarStart.SelectedDate > MyCalendarEnd.SelectedDate)
            {
                MyMessage.Text = "Prvi datum mora da bude pre drugog";
                MyMessage.ControlStyle.ForeColor = Color.Red;
            }
        }

        protected void Calendar_SelectionChanged(object sender, EventArgs e)
        {
            if (chkEngleski.Checked)
                f1();
            else
                f2();
            proveriDatume();
        }

        protected void f1()
        {
            var startDate = MyCalendarStart.SelectedDate.ToString();
            var endDate = MyCalendarEnd.SelectedDate.ToString();
            MyMessage.Text = "Selected date range is: " + startDate + " - " + endDate;
            MyMessage.Visible = true;
            MyMessage.ControlStyle.ForeColor = Color.Black;
        }


        protected void f2()
        {
            var startDate = MyCalendarStart.SelectedDate.ToString();
            var endDate = MyCalendarEnd.SelectedDate.ToString();
            MyMessage.Text = "Selektovani opseg datuma je: " + startDate + " - " + endDate;
            MyMessage.Visible = true;
            MyMessage.ControlStyle.ForeColor = Color.Black;
        }
    }
}
